package com.kun.service_train.service.impl;

import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kun.service_train.entity.Student;
import com.kun.service_train.entity.excel.StudentData;
import com.kun.service_train.listener.studentListener;
import com.kun.service_train.mapper.StudentMapper;
import com.kun.service_train.service.StudentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author testjava
 * @since 2021-11-05
 */
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {



    @Override
    public void saveSubject(MultipartFile file, StudentService studentService) {
        try {
            InputStream fileInputStream = file.getInputStream();
            EasyExcel.read(fileInputStream, StudentData.class,new studentListener(studentService)).sheet().doRead();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
